package com.scau.ums.util.dao;

/**
 * author: 莫伟杰
 * date： 2019/7/24 11:08
 */
public class SelectByPageSql {

    //分页选择
    public String selectByPage(String table,int startIndex,int pageSize)
    {
        return "SELECT * FROM `"+table+"` LIMIT "+startIndex+","+pageSize+";";
    }

    //orderClause顺序语句 例如 "date DESC" 表示根据date列倒序
    public String selectByPageSetOrderByClause(String table,String clause,int startIndex,int pageSize)
    {
        return "SELECT * FROM `"+table+"` ORDER BY "+clause
                +" LIMIT "+startIndex+","+pageSize+";";
    }
    public String selectRowByPageSetOrderByClause
            (String table,String orderClause,int startIndex,int pageSize,String whereClause)
    {
        return "SELECT * FROM `"+table+"`"+" where "+whereClause+" ORDER BY "+orderClause
                +" LIMIT "+startIndex+","+pageSize+";";
    }

}
